package com.chris.design.pattern.samples.observer;

import com.alibaba.fastjson.JSON;

public class ConcreteObserver implements Observer {

    private String observerState;


    @Override
    public void update(String newState) {
        this.observerState = newState;
        System.out.println("观察者状态为:" + observerState);
    }

    /**
     * 拉模型
     *
     * @param subject
     */
    @Override
    public void update(AbstractSubject subject) {
        this.observerState = ((ConcreteSubject) subject).getState();
        System.out.println("观察者状态为:" + observerState);
    }
}
